package com.example.mapper;

import com.example.dto.CheckItemReport;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface CireportMapper {
    // 根据套餐ID(smId)查询所有关联的检查项目ID(ciId)
    @Select("SELECT ciId FROM setmealdetailed WHERE smId = #{smId}")
    List<Integer> findCheckItemIdsBySetMealId(Integer smId);

    // 根据检查项目ID(ciId)查询检查项目名称(ciName)
    @Select("SELECT ciName FROM checkitem WHERE ciId = #{ciId}")
    String findCheckItemNameById(Integer ciId);

    // 插入检查报告记录
    @Insert("INSERT INTO cireport (ciId, ciName, orderId) VALUES (#{ciId}, #{ciName}, #{orderId})")
    int insertCheckItemReport(CheckItemReport checkItemReport);

}
